<div class="eject_con">
  <div id="warning" class="alert alert-error"></div>
  <form id="category_form" method="post" target="_parent" action="index.php?s=seller/store/goods_class_save">
    <input type="hidden" name="id" value="{$class_info.id|default=''}" />
    <dl>
      <dt><i class="required">*</i>分类名称：</dt>
      <dd>
        <input class="text w200" type="text" name="name" id="name" value="{$class_info.name ?? ''}" />
      </dd>
    </dl>
    <dl>
      <dt>排序：</dt>
      <dd>
        <input class="text w60" type="text" name="sort" value="{$class_info.sort ?? ''}"  />
      </dd>
    </dl>
    <dl>
      <dt>显示状态：</dt>
      <dd>
        <label>
          <input type="radio" name="state" value="1" checked="checked"/>是</label>
        <label>
          <input type="radio" name="state" value="0" {if condition="isset($class_id) and $class_id neq '' and isset($class_inf) and $class_info.state eq 0"}checked="checked"{/if} />否</label>
      </dd>
    </dl>
    <div class="bottom">
        <label class="submit-border"><input type="submit" class="submit" value="提交" /></label>
    </div>
  </form>
</div>
<script type="text/javascript">
$(function(){
    $('#category_form').validate({
        errorLabelContainer: $('#warning'),
        invalidHandler: function(form, validator) {
               $('#warning').show();
        },
    	submitHandler:function(form){
    		ajaxpost('category_form', '', '', 'onerror') 
    	},
        rules : {
            name : {
                required : true
            },
            sort : {
                number   : true
            }
        },
        messages : {
            name : {
                required : '<i class="icon-exclamation-sign"></i>分类名称为空'

            },
            sort  : {
                number   : '<i class="icon-exclamation-sign"></i>排序必须为数字'
            }
        }
    });
});
</script> 